<style lang="scss" scoped>
.logo{
  display: flex;
  justify-content: center;
  padding-top: 60rpx;
  margin-bottom: 30rpx;

  image{
    max-width: 356rpx;
    max-height: 80rpx;
  }
}

.example-list{
  padding-left: 40rpx;
  padding-right: 40rpx;
  margin-bottom: 35rpx;

  & > view{
    &:nth-child(1){
      display: flex;
      align-items: center;
      font-size: 28rpx;
      margin-bottom: 26rpx;

      image{
        width: 30rpx;
        height: 30rpx;
        margin-right: 15rpx;
      }
    }
    &:nth-child(2){
      & > view{
        display: flex;
        align-items: center;
        height: 80rpx;
        background: #FFFFFF;
        border-radius: 40rpx;
        padding-left: 28rpx;
        padding-right: 28rpx;
        margin-bottom: 20rpx;
        &:last-child{
          margin-bottom: 0;
        }

        & > view{
          &:nth-child(1){
            @include textOverflow();

            flex: 1;
            font-size: 24rpx;
            margin-right: 20rpx;
          }
          &:nth-child(2){
            font-size: 22rpx;
            display: flex;
            align-items: center;
          }
        }
      }
    }
  }
}
</style>

<template>
  <view>
    <view class="logo">
      <image src="../../static/images/logo.png" alt="" />
    </view>

    <view class="pb-30">

      <view class="example-list" v-for="x in list" :key="x.id">
        <view>
          <image mode="aspectFill" :src="x.image" alt="" />{{ x.name }}
        </view>
        <view>
          <view @click="selectItem(j)" v-for="j in x.children" :key="j.id">
            <view>{{ j.content }}</view>
            <view><text class="iconfont icon-jinru"></text></view>
          </view>
        </view>
      </view>


    </view>
  </view>
</template>

<script>
export default {
  name: "ExampleList",
  created() {
    this.httpClient.post({
      url: this.APIPath.sample.getChildList,
      noLoading: true,
      data: {}
    }).then(res => {
      const arr = []
      res.data.forEach(res => {
        if(res.children && res.children.length > 0) {
          arr.push(res)
        }
      })

      this.list = arr
    }, err => {
    })
  },
  data() {
    return {
      list: []
    }
  },
  methods: {
    selectItem(j) {
      this.$emit('send', j.content)
    }
  }
}
</script>
